﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NuckChorris
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            NuckChorrisSettings.myPrefs.Load();

            checkBoxDisableMovement.Checked = NuckChorrisSettings.myPrefs.DisableAllMovement;
            checkBoxDisableFacing.Checked = NuckChorrisSettings.myPrefs.DisableFacing;
            checkBoxAgiBuff.Checked = NuckChorrisSettings.myPrefs.agibuff;
            checkBoxInterrupt.Checked = NuckChorrisSettings.myPrefs.UseInterrupt;
            checkBoxWhiteTiger.Checked = NuckChorrisSettings.myPrefs.critbuff;
            checkBoxXuen.Checked = NuckChorrisSettings.myPrefs.Xuen;
            checkBoxAlchFlask.Checked = NuckChorrisSettings.myPrefs.AlchFlask;
            checkBoxFlasks.Checked = NuckChorrisSettings.myPrefs.AgiFlask;
            checkBoxVirmen.Checked = NuckChorrisSettings.myPrefs.VirmenPotion;
            checkBoxDisableTargetting.Checked = NuckChorrisSettings.myPrefs.DisableTargetting;

            numericUpDownNoTouchOfDeath.Value = new decimal(NuckChorrisSettings.myPrefs.NoTouchOfDeath);
            numericUpDownNoFistsOfFury.Value = new decimal(NuckChorrisSettings.myPrefs.NoFistsOfFury);
            numericUpDownAOE.Value = new decimal(NuckChorrisSettings.myPrefs.UseAoe);
            numericUpDownDrinkEat.Value = new decimal(NuckChorrisSettings.myPrefs.DrinkEat);
            numericUpDownFortBrew.Value = new decimal(NuckChorrisSettings.myPrefs.FortBrew);
            numericUpDownExpelHarm.Value = new decimal(NuckChorrisSettings.myPrefs.ExpelHarm);
            numericUpDownElitesNotInParty.Value = new decimal(NuckChorrisSettings.myPrefs.ElitesNotInParty);
            numericUpDownTigereye.Value = new decimal(NuckChorrisSettings.myPrefs.NoTigereyeBrew);
            numericUpDownKarma.Value = new decimal(NuckChorrisSettings.myPrefs.UseTouchOfKarma);
            numericUpDownEngiBeltHealth.Value = new decimal(NuckChorrisSettings.myPrefs.EngiBeltHealth);
            numericUpDownHealthPotions.Value = new decimal(NuckChorrisSettings.myPrefs.HealthPotion);
            numericUpDownHealthstone.Value = new decimal(NuckChorrisSettings.myPrefs.healthstone);
            numericUpDownNaruu.Value = new decimal(NuckChorrisSettings.myPrefs.GiftOfNaruu);
            numericUpDown1.Value = new decimal(NuckChorrisSettings.myPrefs.LifeSpirit);
            numericUpDownTigereyeBrewStacks.Value = new decimal(NuckChorrisSettings.myPrefs.TEBStacks);
            numericUpDownHealingSpheresPercent.Value = new decimal(NuckChorrisSettings.myPrefs.HealingSpheresPercent);

            comboBoxHealingSpheresYorN.SelectedIndex = NuckChorrisSettings.myPrefs.HealingSpheres;
            comboBoxMtrinket1.SelectedIndex = NuckChorrisSettings.myPrefs.Mtrinket1;
            comboBoxMtrinket2.SelectedIndex = NuckChorrisSettings.myPrefs.Mtrinket2;
            comboBoxMengigloves.SelectedIndex = NuckChorrisSettings.myPrefs.MEngiGloves;
            comboBoxHEngiBelt.SelectedIndex = NuckChorrisSettings.myPrefs.HEngiBelt;
            comboBoxHHealthPotions.SelectedIndex = NuckChorrisSettings.myPrefs.HHealthPotions;
            comboBoxHHealthstone.SelectedIndex = NuckChorrisSettings.myPrefs.HHealthstone;
            comboBoxHNaruu.SelectedIndex = NuckChorrisSettings.myPrefs.HNaruu;
            comboBoxHLifeSpirit.SelectedIndex = NuckChorrisSettings.myPrefs.HLifeSpirit;
            comboBoxHLifeblood.SelectedIndex = NuckChorrisSettings.myPrefs.HLifeblood;
            comboBoxGlyphToucDeath.SelectedIndex = NuckChorrisSettings.myPrefs.GTouchDeath;
            comboBoxPausekey.SelectedIndex = NuckChorrisSettings.myPrefs.PauseKey;
            switch (NuckChorrisSettings.myPrefs.PauseKey)
            {
                case 0:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.None;
                    break;
                case 1:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.LCTRL;
                    break;
                case 4:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.RCTRL;
                    break;
                case 5:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.LALT;
                    break;
                case 6:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.RALT;
                    break;
            }

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void checkBoxDisableMovement_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.DisableAllMovement = checkBoxDisableMovement.Checked;
        }

        private void checkBoxDisableFacing_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.DisableFacing = checkBoxDisableFacing.Checked;
        }

        private void buttonSafe_Click(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.Save();
            Close();
        }

        private void numericUpDownNoTouchOfDeath_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.NoTouchOfDeath = (int)numericUpDownNoTouchOfDeath.Value;
        }

        private void numericUpDownNoFistsOfFury_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.NoFistsOfFury = (int)numericUpDownNoFistsOfFury.Value;
        }

        private void numericUpDownAOE_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.UseAoe = (int)numericUpDownAOE.Value;
        }

        private void numericUpDownDrinkEat_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.DrinkEat = (int)numericUpDownDrinkEat.Value;
        }

        private void checkBoxAgiBuff_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.agibuff = checkBoxAgiBuff.Checked;
        }

        private void checkBoxInterrupt_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.UseInterrupt = checkBoxInterrupt.Checked;
        }

        private void checkBoxWhiteTiger_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.critbuff = checkBoxWhiteTiger.Checked;
        }

        private void checkBoxXuen_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.Xuen = checkBoxXuen.Checked;
        } 
        private void numericUpDownFortBrew_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.FortBrew = (int)numericUpDownFortBrew.Value;
        }

        private void numericUpDownExpelHarm_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.ExpelHarm = (int)numericUpDownExpelHarm.Value;
        }

        private void numericUpDownElitesNotInParty_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.ElitesNotInParty = (int)numericUpDownElitesNotInParty.Value;
        }

        private void numericUpDownTigereye_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.NoTigereyeBrew = (int)numericUpDownTigereye.Value;
        }

        private void numericUpDownKarma_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.UseTouchOfKarma = (int)numericUpDownKarma.Value;
        } 

        private void numericUpDownEngiBeltHealth_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.EngiBeltHealth = (int)numericUpDownEngiBeltHealth.Value;
        } 
        private void numericUpDownHealthPotions_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.HealthPotion = (int)numericUpDownHealthPotions.Value;
        }

        private void numericUpDownHealthstone_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.healthstone = (int)numericUpDownHealthstone.Value;
        }

        private void numericUpDownNaruu_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.GiftOfNaruu = (int)numericUpDownNaruu.Value;
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.LifeSpirit = (int)numericUpDown1.Value;
        }

        private void checkBoxAlchFlask_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.AlchFlask = checkBoxAlchFlask.Checked;
        }

        private void checkBoxFlasks_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.AgiFlask = checkBoxFlasks.Checked;
        }

        private void checkBoxVirmen_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.VirmenPotion = checkBoxVirmen.Checked;
        }

        private void checkBoxDisableTargetting_CheckedChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.DisableTargetting = checkBoxDisableTargetting.Checked;
        }

        private void comboBoxMtrinket1_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.Mtrinket1 = comboBoxMtrinket1.SelectedIndex;
        }

        private void comboBoxMtrinket2_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.Mtrinket2 = comboBoxMtrinket2.SelectedIndex;
        }

        private void comboBoxMengigloves_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.MEngiGloves = comboBoxMengigloves.SelectedIndex;
        }

        private void comboBoxHEngiBelt_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.HEngiBelt = comboBoxHEngiBelt.SelectedIndex;
        }

        private void comboBoxHHealthPotions_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.HHealthPotions = comboBoxHHealthPotions.SelectedIndex;
        }

        private void comboBoxHHealthstone_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.HHealthstone = comboBoxHHealthstone.SelectedIndex;
        }

        private void comboBoxHNaruu_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.HNaruu = comboBoxHNaruu.SelectedIndex;
        }

        private void comboBoxHLifeSpirit_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.HLifeSpirit = comboBoxHLifeSpirit.SelectedIndex;
        }

        private void comboBoxHLifeblood_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.HLifeblood = comboBoxHLifeblood.SelectedIndex;
        }

        private void comboBoxGlyphToucDeath_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.GTouchDeath = comboBoxGlyphToucDeath.SelectedIndex;
        }

        private void numericUpDownTigereyeBrewStacks_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.TEBStacks = (int)numericUpDownTigereyeBrewStacks.Value;
        }

        private void comboBoxPausekey_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.PauseKey = comboBoxPausekey.SelectedIndex;
            switch (comboBoxPausekey.SelectedIndex)
            {
                case 0:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.None;
                    break;
                case 1:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.LCTRL;
                    break;
                case 4:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.RCTRL;
                    break;
                case 5:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.LALT;
                    break;
                case 6:
                    NuckChorrisSettings.myPrefs.PauseKeys = NuckChorrisSettings.Keypress.RALT;
                    break;
            }
        }

        private void comboBoxHealingSpheresYorN_SelectedIndexChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.HealingSpheres = comboBoxHealingSpheresYorN.SelectedIndex;
        }

        private void numericUpDownHealingSpheresPercent_ValueChanged(object sender, EventArgs e)
        {
            NuckChorrisSettings.myPrefs.HealingSpheresPercent = (int)numericUpDownHealingSpheresPercent.Value;
        } 
    }
}
